package com.laihui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.blankj.utilcode.util.StringUtils;
import com.laihui.activity.R;
import com.laihui.entity.TenderList;
import com.laihui.model.InvestDetail;
import com.laihui.utils.YXDate;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;

/**
 * Created by ST on 2017/7/25.
 */

public class TenderListAdapter extends RecyclerArrayAdapter<TenderList.Tender>{
    public TenderListAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new TenderListViewHolder(parent);
    }

    class TenderListViewHolder extends BaseViewHolder<TenderList.Tender> {
         TextView tv_mobile,tv_money,tv_tender_time,time_detail;

        public TenderListViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_tenderlist);
            tv_mobile = $(R.id.tv_mobile);
            tv_money = $(R.id.tv_money);
            tv_tender_time = $(R.id.tv_tender_time);
            time_detail = $(R.id.time_detail);
        }

        @Override
        public void setData(TenderList.Tender data) {
            tv_mobile.setText(StringUtils.isEmpty(data.u_userName)?"暂未填写":data.u_userName.substring(0,3)+"****"+data.u_userName.substring(7,11));
            tv_money.setText(data.success_money+"");
            tv_tender_time.setText(YXDate.TimeStamp2DateTimeYear(data.addtime));
            time_detail.setText(YXDate.TimeStamp2DateTimeTime(data.addtime));
            super.setData(data);

        }
    }

}
